package leaf.science.ui.topbar
{
	import caurina.transitions.Tweener;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	public class TopBar extends Sprite
	{
		private var _bg:Sprite;
		private var _link:MovieClip;
		private var _logo:Sprite;
		
		public function TopBar()
		{
			setupSkin();
		}
		
		public function goIn():void
		{
			Tweener.addTween(this, {y:0, time:0.6});
		}
		
		public function goOut():void
		{
			Tweener.addTween(this, {y:-60, time:0.6});
		}
		
		private function setupSkin():void
		{
			y = -60;
			
			var skin:LeafTopBarSkin = new LeafTopBarSkin();
			
			_bg = skin.bg_mc;
			addChild(_bg);
			_link = skin.link_mc;
			_link.buttonMode = true;
			addChild(_link);
			_logo = skin.logo_mc;
			addChild(_logo);
			
		}
		
		override public function set width(value:Number):void
		{
			_bg.width = value;
			_logo.x = value - 18;
		}

	}
}